package cn.net.sinodata.system.controller.monitor;

import cn.net.sinodata.common.core.domain.R;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Properties;

/**
 * 缓存监控
 *
 * @author yinliangyun
 */
@RequiredArgsConstructor
@RestController
@RequestMapping("/monitor/cache")
public class CacheController {

    /**
     * 获取缓存监控列表
     */
    @GetMapping()
    public R<CacheListInfoVo> getInfo() throws Exception {
        // TODO
        Properties info = new Properties();
        Long dbSize = 0L;
        List<Map<String, String>> commandStats = new ArrayList<>();
        return R.ok(new CacheListInfoVo(
            info,
            dbSize, commandStats));
    }

    public record CacheListInfoVo(Properties info, Long dbSize, List<Map<String, String>> commandStats) {}

}
